package org.gbif.portal.action;

import org.gbif.portal.action.BaseAction;

public class AdminAction extends BaseAction {
	private boolean reloadConfig=false;
	private String key;
	private String val;
	
	public AdminAction(){
		this.currentMenu="admin";
	}
	
	public String execute(){
		if (!isLoggedIn()){
			return NOT_ALLOWED;
		}
		if (reloadConfig){
			this.addActionMessage("Sorry, reloading of application properties not yet implmented");
		}

		if (key!=null&&val!=null){
			cfg.setProperty(key, val);
			this.addActionMessage("Property "+key+" set to "+val);
		}
		return SUCCESS;
	}


	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getVal() {
		return val;
	}

	public void setVal(String val) {
		this.val = val;
	}

	public boolean isReloadConfig() {
		return reloadConfig;
	}

	public void setReloadConfig(boolean reloadConfig) {
		this.reloadConfig = reloadConfig;
	}
	
}
